class MedialProfileController < ApplicationController
  
  def show
    id = params[:id].to_i
    mp = MedialProfile.find id
    @medial_profile = mp.attributes
    services = mp.user.services.select {|s| s.used == true}
    @virtual_profiles = []
    
    fields = mp.attribute_names
    fields.delete "id"
    fields.delete "last_update"
    fields.delete "user_id"
    fields.delete "service_count"
    
    services.each { |s|
      data = s.crawl.data
      info = {}
      info["id"] = s.id
      info["ff_id"] = s.ff_id
      fields.each {|f| info[f] = "(#{data.send(f)},#{data.trust_of f})" if data.has_attribute?(f) && !data.send(f).nil? }
      @virtual_profiles << info
      puts "####info size #{info.size}  fields #{fields.size}####"
    }
  end
  
end
